#pragma once

#include <jnipp.h>

DEFINE_JCLASS_BEGIN(JDisplayMode,"keel/runtime/DisplayMode")
	DEFINE_JCLASS_INIT("(IIII)V")
	DEFINE_JCLASS_FIELD(jint,width,"I")
	DEFINE_JCLASS_FIELD(jint,height,"I")
	DEFINE_JCLASS_FIELD(jint,bitdepth,"I")
	DEFINE_JCLASS_FIELD(jint,refreshrate,"I")
	void create(JNIEnv*env,const DEVMODE& devmode);
	void operator=(const DEVMODE& devmode);
	operator DEVMODE();
DEFINE_JCLASS_END()

DEFINE_JCLASS_BEGIN(JPixelFormat,"keel/gfx/PixelFormat")
	DEFINE_JCLASS_INIT("(JIIIIIIIIIIII)V")
	DEFINE_JCLASS_INIT_X(0,"(JIIIIIIIIIIIII)V")
	DEFINE_JCLASS_FIELD(jlong,nativeref,"J")
	void createEnum(JNIEnv *env,HWND hWnd,HDC hDc,int &i);
	void createNull(JNIEnv *env);
DEFINE_JCLASS_END()

DEFINE_JCLASS_BEGIN(JCursor,"keel/runtime/Cursor")
	DEFINE_JCLASS_INIT("(I)V")
	DEFINE_JCLASS_FIELD(jlong,nativeContext,"J")
	DEFINE_JCLASS_FIELD(jint,type,"I")
DEFINE_JCLASS_END()

DEFINE_JCLASS_BEGIN(JApplicationEvent,"keel/runtime/event/ApplicationEvent")
	DEFINE_JCLASS_INIT("(I)V")
DEFINE_JCLASS_END()

DEFINE_JCLASS_BEGIN(JMouseEvent,"keel/runtime/event/MouseEvent")
	DEFINE_JCLASS_INIT("(IIIIIZI)V")
DEFINE_JCLASS_END()

DEFINE_JCLASS_BEGIN(JWindowsInputMethod,"backstage/runtime/im/WindowsInputMethod")
	DEFINE_JCLASS_METHOD_STATIC(jobject,createInputMethodEvent,"(ILjava/lang/String;[I[Ljava/lang/String;[I[BIII)Lkeel/runtime/event/InputMethodEvent;")
	static jobject _createInputMethodEvent(JNIEnv*env,jint id,jint* clause,int clauseLen,jstring str,jstring* subStrings,int attrLen,jint* attrClause,jbyte* attr,jint commitedTextLength, jint caretPos, jint visiblePos);
DEFINE_JCLASS_END()

DEFINE_JCLASS_BEGIN(JString,"java/lang/String")
	DEFINE_JCLASS_METHOD(jobject,concat,"(Ljava/lang/String;)Ljava/lang/String;")
DEFINE_JCLASS_END()
#define concat(...) _concat(0,__VA_ARGS__)

DEFINE_JCLASS_BEGIN(JBigInteger,"java/math/BigInteger")
	DEFINE_JCLASS_INIT("(Ljava/lang/String;I)V")
	DEFINE_JCLASS_METHOD(jboolean,testBit,"(I)Z")
DEFINE_JCLASS_END()
#define testBit(...) _testBit(0,__VA_ARGS__)

DEFINE_JCLASS_BEGIN(JKeyEvent,"keel/runtime/event/KeyEvent")
	DEFINE_JCLASS_INIT("(IIIC)V")
DEFINE_JCLASS_END()

DEFINE_JCLASS_BEGIN(JPassiveInputMethodRequests,"")
	DEFINE_JCLASS_METHOD(jobject,getCompositionLocation,"()[I")
DEFINE_JCLASS_END()
#define getCompositionLocation(...) _getCompositionLocation(0,__VA_ARGS__)

DEFINE_JCLASS_BEGIN(JActiveInputMethodRequests,"")
	DEFINE_JCLASS_METHOD(jobject,getCandidateLocation,"()[I")
DEFINE_JCLASS_END()
#define getCandidateLocation(...) _getCandidateLocation(0,__VA_ARGS__)

DEFINE_JCLASS_BEGIN(JKeelRuntimeImpl,"")
	DEFINE_JCLASS_FIELD(jobject,displaymode,"Lkeel/runtime/DisplayMode;")
DEFINE_JCLASS_END()